import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
import org.dom4j.io.XMLWriter;

import java.io.File;
import java.io.FileOutputStream;

public class Demo5 {
    public static void main(String[] args) throws Exception {
        SAXReader reader = new SAXReader();
        Document document = reader.read(new File("src/收藏信息.xml"));

        Element rootElement = document.getRootElement();

        Element brand = DocumentHelper.createElement("Brand");
        brand.addAttribute("name","oppo");

        Element type = DocumentHelper.createElement("Type");
        type.addAttribute("name","A3");
        
        brand.add(type);
        
        rootElement.add(brand);
    }
}
